from twisted.internet import reactor
from twisted.web import static, server, script
+from xen.util.ip import _readline, _readlines
+
class Daemon:
"""The xend daemon.
"""
return 0
# Read the pid of the previous invocation and search active process list.
pid = open(PID_FILE, 'r').read()
- lines = os.popen('ps ' + pid + ' 2>/dev/null').readlines()
+ lines = _readlines(os.popen('ps ' + pid + ' 2>/dev/null'))
for line in lines:
if re.search('^ *' + pid + '.+xensv', line):
if not kill:
import string
from xen.xend import XendRoot
+
+from xen.util.ip import _readline, _readlines
+
xroot = XendRoot.instance()
"""Where network control scripts live."""
args = ' '.join(args)
out = os.popen(script + ' ' + args)
- output = out.readline()
+ output = _readline(out)
out.close()
return string.rstrip(output)
from xen.xend import XendRoot
from xen.xend.XendLogging import log
+from xen.util.ip import _readline, _readlines
+
import channel
import blkif
import netif
"""
running = 0
if pid:
- lines = os.popen('ps %d 2>/dev/null' % pid).readlines()
+ lines = _readlines(os.popen('ps %d 2>/dev/null' % pid))
exp = '^ *%d.+%s' % (pid, name)
for line in lines:
if re.search(exp, line):
import controller
from messages import *
+from xen.util.ip import _readline, _readlines
+
def expand_dev_name(name):
if re.match( '^/dev/', name ):
return name
def check_mounted(self, name):
mode = None
name = expand_dev_name(name)
- lines = os.popen('mount 2>/dev/null').readlines()
+ lines = _readlines(os.popen('mount 2>/dev/null'))
exp = re.compile('^' + name + ' .*[\(,]r(?P<mode>[ow])[,\)]')
for line in lines:
pm = exp.match(line)